import ApiConfig from "@/config/api.config";
import Mock from "mockjs";
import ServerInfo from "@/static/json/baseServer.json";

/**
 * 登录拦截
 */
export const Login = () => {
  Mock.mock(ServerInfo.baseUrl + ApiConfig.User.login, "post", (params: any) => {
    console.log(`拦截${ApiConfig.User.login}成功\n`, params);
    return {
      Authorization: "ea35ac48-75bc-431e-9a9a-0df0000b6e2c",
    };
  });
};

/**
 * 注册拦截
 */
export const Register = () => {
  Mock.mock(ServerInfo.baseUrl + ApiConfig.User.register, "post", (params: any) => {
    console.log(`拦截${ApiConfig.User.login}成功\n`, params);
    return undefined;
  });
};

/**
 * 用户信息
 */
export const GetUserInfo = () => {
  Mock.mock(ServerInfo.baseUrl + ApiConfig.User.userInfo, "get", (params: any) => {
    console.log(`拦截${ApiConfig.User.userInfo}成功\n`, params);
    return { userType: 2, isLogin: true };
  });
};
